//
//  ContributionListTableViewHeader.swift
//  SmartHousekeeper
//
//  Created by 张磊 on 2020/2/21.
//  Copyright © 2020 LS. All rights reserved.
//

import UIKit

class ContributionListTableViewHeader: UIView {
    
    lazy var addressL : UILabel = {
        let value = UILabel(textColor: RGBColor(r: 99, g: 99, b: 99, a: 1), textFont: UIFont.systemFont(ofSize: Adapter(13)))
        value.text = "绑定房屋地址:株洲市建宁花园小区3栋1002室"
        value.numberOfLines = 2
        return value
    }()
    
    lazy var titlelL1: UILabel = {
        let value = UILabel(textColor: RGBColor(r: 40, g: 40, b:  40, a: 1), textFont: UIFont.boldSystemFont(ofSize: Adapter(15)))
        value.text = "您的缴费非常及时，感谢您的支持!"
        return value
    }()
    
    lazy var titlelL2: UILabel = {
        let value = UILabel(textColor: RGBColor(r: 160, g: 160, b:  160, a: 1), textFont: UIFont.systemFont(ofSize: Adapter(13)))
        value.text = "欢迎您使用线上缴费平台缴费。"
        return value
    }()
    
    lazy var imgBank : UIImageView = { // 129 38
        let value = UIImageView()
        return value
    }()
    
    lazy var bankCardNoL: UILabel = {
        let value = UILabel(textColor: RGBColor(r: 99, g: 99, b: 99, a: 1), textFont: UIFont.systemFont(ofSize: Adapter(11)))
        value.text = "43022 10101 2030 090"
        return value
    }()
    
    lazy var selectBankBtn: UIButton = {
        let value = UIButton()
        value.setImage(UIImage(named: "icon_bottom"), for: .normal)
        return value
    }()

    lazy var switchV : UISwitch = {
        let value = UISwitch()
        //设置开启状态显示的颜色
        value.onTintColor = RGBColor(r: 62, g: 134, b: 230, a: 1)
        //设置关闭状态的颜色
        value.tintColor = .black
        //滑块上小圆点的颜色
        value.thumbTintColor = .white
        value.isOn = true

        return value
    }()
    
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    override init(frame: CGRect) {
        super .init(frame: frame)
        setHeader()
    }
    func setHeader() {
        self.addSubview(addressL)
        addressL.snp.makeConstraints { (make) in
            make.left.equalTo(self).offset(Adapter(30))
            make.right.equalTo(self).offset(-Adapter(30))
            make.top.equalToSuperview().offset(Adapter(5))
            make.height.equalTo(Adapter(35))
        }
        
        let line = UIView()
        line.backgroundColor = RGBColor(r: 114, g: 114, b: 114, a: 1)
        self.addSubview(line)
        line.snp.makeConstraints { (make) in
            make.left.equalTo(self).offset(Adapter(15))
            make.right.equalTo(self).offset(-Adapter(15))
            make.top.equalTo(addressL.snp.bottom).offset(Adapter(15))
            make.height.equalTo(Adapter(0.8))
        }
        
        let imglogo = UIImageView(image: UIImage(named: "icon_success"))
        self.addSubview(imglogo)
        imglogo.snp.makeConstraints { (make) in
            make.left.equalTo(self).offset(Adapter(30))
            make.top.equalTo(line.snp.bottom).offset(Adapter(15))
            make.size.equalTo(CGSize(width: Adapter(20), height: Adapter(20)));
        }
        
        self.addSubview(titlelL1)
        titlelL1.snp.makeConstraints { (make) in
            make.left.equalTo(imglogo.snp.right).offset(Adapter(10))
            make.centerY.equalTo(imglogo)
            make.height.equalTo(Adapter(Adapter(20)))
            make.right.equalToSuperview().offset(-Adapter(30))
        }
        
        self.addSubview(titlelL2)
        titlelL2.snp.makeConstraints { (make) in
            make.left.equalTo(titlelL1)
            make.top.equalTo(titlelL1.snp.bottom).offset(Adapter(5))
            make.height.equalTo(Adapter(Adapter(15)))
            make.right.equalTo(titlelL1)
        }
        
        let bordView = UIView()
        bordView.layer.borderWidth = 0.8;
        bordView.layer.borderColor = RGBColor(r: 114, g: 114, b: 114, a: 114).cgColor
        self.addSubview(bordView)
        bordView.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(Adapter(15))
            make.right.equalToSuperview().offset(-Adapter(15))
            make.top.equalTo(titlelL2.snp.bottom).offset(Adapter(15))
            make.height.equalTo(Adapter(75))
        }
        
        bordView.addSubview(imgBank)
        imgBank.image = UIImage(named: "icon_csbank")
        imgBank.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(Adapter(10))
            make.top.equalToSuperview().offset(Adapter(10))
            make.size.equalTo(CGSize(width: Adapter(129), height: Adapter(38)))
        }
        
        bordView.addSubview(bankCardNoL)
        bankCardNoL.snp.makeConstraints { (make) in
            make.left.equalTo(imgBank)
            make.top.equalTo(imgBank.snp.bottom).offset(Adapter(5))
            make.height.equalTo(Adapter(12))
        }
        
        bordView.addSubview(selectBankBtn)
        selectBankBtn.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalTo(imgBank.snp.right)
            make.size.equalTo(CGSize(width: Adapter(50), height: Adapter(50)))
        }
        bordView.addSubview(switchV)
        switchV.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-Adapter(15))
        }
        
        let aotuPay = UILabel(textColor: RGBColor(r: 40, g: 40, b:  40, a: 1), textFont: UIFont.systemFont(ofSize: Adapter(13)))
        aotuPay.text = "自动代扣"
        bordView.addSubview(aotuPay)
        aotuPay.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.right.equalTo(switchV.snp.left).offset(-Adapter(5))

        }
        
        
    }
   
    
}
